#ifndef INFINITY_SERVICE_KEY_INL
#	define INFINITY_SERVICE_KEY_INL

namespace infinity {

inline ServiceKey::ServiceKey()
{
	memset(m_name, 0, sizeof (m_name));
}

/*explicit*/ inline ServiceKey::ServiceKey(const char* name)
{
	dwAssert(name != NULL, "ServiceKey's name is not valid");
	dwAssert(strnlen_s(name, NAME_MAX_LENGTH) < NAME_MAX_LENGTH, "ServiceKey's name is too long");

	memset(m_name, 0, sizeof (m_name));

	strncpy_s(m_name, name, NAME_MAX_LENGTH);
	m_name[NAME_MAX_LENGTH - 1] = 0;
}

inline ServiceKey::ServiceKey(const ServiceKey& ref)
{
	memcpy(m_name, ref.m_name, sizeof (m_name));
}

inline ServiceKey& ServiceKey::operator = (const ServiceKey& rhs)
{
	memcpy(m_name, rhs.m_name, sizeof (m_name));

	return *this;
}

inline bool operator == (const ServiceKey& lhs, const ServiceKey& rhs)
{
	return memcmp(lhs.m_name, rhs.m_name, sizeof (lhs.m_name)) == 0;
}

inline bool operator != (const ServiceKey& lhs, const ServiceKey& rhs)
{
	return memcmp(lhs.m_name, rhs.m_name, sizeof (lhs.m_name)) != 0;
}

inline bool operator >= (const ServiceKey& lhs, const ServiceKey& rhs)
{
	return memcmp(lhs.m_name, rhs.m_name, sizeof (lhs.m_name)) >= 0;
}

inline bool operator <= (const ServiceKey& lhs, const ServiceKey& rhs)
{
	return memcmp(lhs.m_name, rhs.m_name, sizeof (lhs.m_name)) <= 0;
}

inline bool operator > (const ServiceKey& lhs, const ServiceKey& rhs)
{
	return memcmp(lhs.m_name, rhs.m_name, sizeof (lhs.m_name)) > 0;
}

inline bool operator < (const ServiceKey& lhs, const ServiceKey& rhs)
{
	return memcmp(lhs.m_name, rhs.m_name, sizeof (lhs.m_name)) < 0;
}

} // namespace infinity

#endif // !INFINITY_SERVICE_KEY_INL
